
//
//  UILabel+Extension.swift
//  01-WeiBo
//
//  Created by 李晓东 on 17/6/26.
//  Copyright © 2017年 PeanutXu. All rights reserved.
//

import UIKit
extension UILabel{
    convenience init(labelTxt:String, font:UIFont = UIFont.systemFont(ofSize: 14), textColor:UIColor = UIColor.darkGray, screenInsert:CGFloat = 0) {
        self.init()
        text = labelTxt
        self.font = font
        self.textColor = textColor
        numberOfLines = 0
        
        if screenInsert == 0 {
            self.textAlignment = NSTextAlignment.center
        } else {
            self.textAlignment = NSTextAlignment.left
            
            self.preferredMaxLayoutWidth = UIScreen.main.bounds.width - screenInsert * 2
        }
        
    }
    
}
